home *** CD-ROM | disk | FTP | other *** search
- Path: cc.iu.net!news
- From: Rick Flick <rflick@iu.net>
- Newsgroups: comp.lang.c++
- Subject: help porting 16 bit to 32 bit application with vc++
- Date: Mon, 15 Apr 1996 13:36:42 -0500
- Organization: XLVision
- Message-ID: <3172973A.1192@iu.net>
- NNTP-Posting-Host: netport-44.iu.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Help!
- I am trying to get the following code to work in 32 bit mode using Microsoft Visual C++ (4.1)
- compiler. It compiles and runs fine using the 16 bit compiler (2.1 I think), but in the 32 bit
- complier, I get the following error at the two lines that are noted:
- error C2443: operand size conflict
-
- I am not an assembly coder so I really have no idea how this piece works, but it does
- (under 16 bits)! It compiles and runs just fine in 16 bits.
-
- I just started with XLVision and as of yet do not have my own e-mail address. If you could
- help, please respond to : melharti@xlvision.com and/or the newsgroup.
-
- here is the offending code:
-
- thanks for your help!
- -jor
- Jordan Thompson
- XLVision
- (407)589-7331
-
-
- WORD FAR change_int_intr( VOID )
- {
- WORD rt;
-
- rt = 0;
- _disable(); //Disable interrupt.
- _asm{
- push DS
- error-> mov AX, DS
- mov ES, AX
- mov DI, OFFSET reg_st ;;ES:DI points to register structure.
- mov AX, CS
- mov DS, AX
- mov SI, OFFSET new_intr_proc;;DS:SI points to new int. procedure.
- error-> mov AX, 303h
- int 31h ;;Allocate real mode Seg:Off (in CX:DX).
- jc error
- pop DS
- mov DLLgv_new_intr_seg, CX ;;Set the Seg:Off to 2 global variables.
- mov DLLgv_new_intr_off, DX
-
- mov BL, DLLgv_hooked_intr ;;Set BL to the 0Dh.
- mov AX, 200h ;;Get the int. vector (in CX:DX).
- int 31h
- jc error
-
- mov DLLgv_old_intr_seg, CX ;;Save old vector (in CX:DX).
- mov DLLgv_old_intr_off, DX
-
- mov BL, DLLgv_hooked_intr ;;Set BL to the 0Dh.
- mov CX, DLLgv_new_intr_seg
- mov DX, DLLgv_new_intr_off
- mov AX, 201h ;;Set new vector to the int.
- int 31h
- jc error
- jmp ok
- error:
- mov rt, 1
- ok:
- }
- _enable(); //Enable interrupt.
-
- return( rt );
- }
-
-
- //return 0: sucessful
- // 1: restore error
- WORD FAR restore_int_intr( VOID )
- {
- WORD rt;
-
- rt = 0;
- _disable(); //Disable interrupt.
- _asm{
- mov CX, DLLgv_old_intr_seg ;;Set the old int.# vector to CX:DX.
- mov DX, DLLgv_old_intr_off
- mov BL, DLLgv_hooked_intr ;;Set 0Dh to BL to be restored.
- mov AX, 201h ;;Restore the interrupt.
- int 31h
- jc error
-
- mov CX, DLLgv_new_intr_seg ;;Set real mode Seg:Off to CX:DX.
- mov DX, DLLgv_new_intr_off
- mov AX, 304h ;;Release the real mode Seg:Off.
- int 31h
- jmp ok
- error:
- mov rt, 1
- ok:
- }
- _enable(); //Enable interrupt.
- return( rt );
- }
-